import { http } from "@/utils/request";
import type { LoginData, LoginRes } from "./types";
import router from "@/router";
// 登录
export const loginAPI = (data: LoginData): Promise<LoginRes> => {
  const response = http.post<LoginRes>("/login", data);
  return response; // 确保返回完整的响应数据
};

// 获取用户信息
export const getUserInfoAPI = (token: string) => {
  return http.get("/users/info", {
    headers: {
      Authorization: `Bearer ${token}`, // 在请求头中携带 token
    },
  }); 
};
